package com.linys.scala.study.demo

/**
  * Created by admin on 2019/10/11.
  */
object TimerAnonymous {
  def oncePerSecond(callback: () => Unit): Unit = {
    while (true) { callback(); Thread sleep 3000 }
  }
  def main(args: Array[String]): Unit = {
    oncePerSecond(() => println("time flies like an arrow..."))
  }
}
